package com.quest.space.poker.dto;

import com.quest.space.poker.base.enums.PokerTypeEnum;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TableDto {
    private String tableId;
    private String landlord;
    private String tableName;
    private Integer playerNum;
    private boolean isRobot;
    private Date startDate;
    private Date endDate;
    private List<PlayerDto> players;
    private Map<String, List<PokerDto>> pokers;
    private String prePoker;
    private List<PokerDto> prePokerList;
    private PokerTypeEnum prePokerType;
    private String prePlayer;
    private boolean over;
    private String winner;
    private String showPlayer;
    private Integer action;//0, pass; 1, no-pass
    private Map<String, String> showPokers;
    private String error;

    public PlayerDto getPlayer(String playerId) {
        return players.stream().filter(p -> p.getPlayerId().equals(playerId)).findFirst().get();
    }

    public List<PokerDto> getAllPokers(String playerId) {
        return pokers.get(playerId);
    }

    public void setAllPokers(String playerId, List<PokerDto> list) {
        pokers.put(playerId, list);
    }

    public void setShowPokers(String player, String pokers) {
        if (showPokers == null) {
            showPokers = new HashMap<>();
        }
        showPokers.put(player, pokers);
        this.showPlayer = player;
    }

    public String getTableId() {
        return tableId;
    }

    public void setTableId(String tableId) {
        this.tableId = tableId;
    }

    public String getLandlord() {
        return landlord;
    }

    public void setLandlord(String landlord) {
        this.landlord = landlord;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public Integer getPlayerNum() {
        return playerNum;
    }

    public void setPlayerNum(Integer playerNum) {
        this.playerNum = playerNum;
    }

    public boolean isRobot() {
        return isRobot;
    }

    public void setRobot(boolean robot) {
        isRobot = robot;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public List<PlayerDto> getPlayers() {
        return players;
    }

    public void setPlayers(List<PlayerDto> players) {
        this.players = players;
    }

    public Map<String, List<PokerDto>> getPokers() {
        return pokers;
    }

    public void setPokers(Map<String, List<PokerDto>> pokers) {
        this.pokers = pokers;
    }

    public String getPrePoker() {
        return prePoker;
    }

    public void setPrePoker(String prePoker) {
        this.prePoker = prePoker;
    }

    public List<PokerDto> getPrePokerList() {
        return prePokerList;
    }

    public void setPrePokerList(List<PokerDto> prePokerList) {
        this.prePokerList = prePokerList;
    }

    public PokerTypeEnum getPrePokerType() {
        return prePokerType;
    }

    public void setPrePokerType(PokerTypeEnum prePokerType) {
        this.prePokerType = prePokerType;
    }

    public String getPrePlayer() {
        return prePlayer;
    }

    public void setPrePlayer(String prePlayer) {
        this.prePlayer = prePlayer;
    }

    public boolean isOver() {
        return over;
    }

    public void setOver(boolean over) {
        this.over = over;
    }

    public String getWinner() {
        return winner;
    }

    public void setWinner(String winner) {
        this.winner = winner;
    }

    public String getShowPlayer() {
        return showPlayer;
    }

    public void setShowPlayer(String showPlayer) {
        this.showPlayer = showPlayer;
    }

    public Integer getAction() {
        return action;
    }

    public void setAction(Integer action) {
        this.action = action;
    }

    public Map<String, String> getShowPokers() {
        return showPokers;
    }

    public void setShowPokers(Map<String, String> showPokers) {
        this.showPokers = showPokers;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }
}
